import 'dart:io';

import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:share_fit/app/components/back_btn_icon.dart';
import 'package:share_fit/app/helper/ext/tr_ext.dart';
import 'package:share_fit/app/tools/color_const.dart';
import 'package:share_fit/generated/locales.g.dart';

class ServicePage extends StatelessWidget {

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      // backgroundColor: Color(0xFFF5F9FB),
      appBar: AppBar(
        // backgroundColor: Color(0xFFF5F9FB),
        title: Text(LocaleKeys.space_service.ts, style: TextStyle(fontSize: 54.sp, color: ColorConst.btnFontColor),),
        centerTitle: true,
        leading: BackBtnIcon(onTap: () => Get.back()),
        // leading: IconButton(
        //   padding: EdgeInsets.only(left: 40.w,),
        //   icon: Image.asset("assets/images/space/icon_appbar_arrow_back.png"),
        //   onPressed: () { Get.back(); },
        // ),
        // leadingWidth: 25,
      ),
      body: Column(
        children: [
          // _buildListTile(LocaleKeys.service_tmall.ts, onTap: (){Get.toNamed('/space/service/tmall');}),
          // _buildListTile(LocaleKeys.service_alipay.ts, onTap: (){Get.toNamed('/space/service/alipay');}),
          // _buildListTile(LocaleKeys.service_wechat.ts, onTap: (){Get.toNamed('/space/service/wechat');}),
          // _buildListTile(LocaleKeys.service_connect_health.ts, onTap: (){
          //   Get.toNamed('/space/service/applehealth');
          // }),
          Visibility(
            visible: Platform.isIOS,
            child: _buildListTile(LocaleKeys.service_connect_health.ts, onTap: (){
              Get.toNamed('/space/service/applehealth');
            }),),
          Visibility(
            visible: Platform.isAndroid,
            child: _buildListTile(LocaleKeys.service_googlefit.ts, onTap: (){
            Get.toNamed('/space/service/googlefit');
          }),),

        ],
      ),
    );
  }

  Widget _buildListTile(String title, {onTap}) {
    var borderRadius = BorderRadius.circular(10);

    return Container(
      height: 175.h,
      margin: EdgeInsets.fromLTRB(43.w, 39.h, 43.w, 0),
      child: Ink(
          decoration: BoxDecoration(
            color: Colors.white,
            borderRadius: borderRadius,
          ),
          child: InkResponse(
            onTap: onTap,
            splashColor: ColorConst.activeColor,
            borderRadius: borderRadius,
            highlightShape: BoxShape.rectangle,
            highlightColor: ColorConst.activeColor,
            containedInkWell: true,
            child: ListTile(
              contentPadding: EdgeInsets.fromLTRB(62.w, 0, 34.w, 0),
              title: Text(title, style: TextStyle(fontSize: 45.sp, color: ColorConst.btnFontColor)),
              trailing: SizedBox(
                child: Icon(
                  size: 37.w,
                  Icons.arrow_forward_ios,),
              ),),
          )),
    );
  }

}